package cn.amos.mvc.webservice;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

/**
 * PROJECT: mvc
 * DESCRIPTION: TODO
 *
 * @author amos.wang
 * @date 2019/4/10
 */
public class HelloWSDemoMain {

    public static void main(String[] args) {
        String address = "http://localhost:8888/cxf/hello";

        HelloWSDemo demo = new HelloWSDemoImpl();
        JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
        bean.setAddress(address);
        bean.setServiceClass(HelloWSDemo.class);
        bean.setServiceBean(demo);
        bean.getInInterceptors().add(new LoggingInInterceptor());
        bean.getOutInterceptors().add(new LoggingOutInterceptor());
        bean.create();

        // Endpoint.publish(address, new HelloWSDemoImpl());
        System.out.println("发布成功!");
        System.out.println("WSDL >>>>> " + address + "?wsdl");
    }

}
